//
//  ZZCGestureManageController.m
//  ZZC-Finance
//
//  Created by mac on 2017/5/25.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "ZZCGestureManageController.h"
#import "ZZCSetGestureController.h"
#import "ZZCDeleteView.h"
#import "ZZCAlterGestureController.h"
@interface ZZCGestureManageController ()
@property (weak, nonatomic) IBOutlet UISwitch *gestureSwitch;
@property (strong, nonatomic) ZZCDeleteView *deleteView;

@end

@implementation ZZCGestureManageController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.gestureSwitch.on = NO;
    [self.gestureSwitch addTarget:self action:@selector(gestureSwitchClick:) forControlEvents:UIControlEventValueChanged];
}

//手势密码设置
- (void)gestureSwitchClick:(UISwitch *)sender {
    if (sender.on) {
        ZZCSetGestureController *ges = [ZZCSetGestureController new];
        [self.navigationController pushViewController:ges animated:YES];
    }
}
- (IBAction)backClick {
    [self.navigationController popViewControllerAnimated:YES];
}
//修改手势密码
- (IBAction)alterPasswordClick {
    ZZCLog(@"修改手势密码");
    ZZCAlterGestureController *alter = [ZZCAlterGestureController new];
    [self.navigationController pushViewController:alter animated:YES];
}
//忘记手势密码
- (IBAction)forgetPasswordClick {
    ZZCLog(@"忘记手势密码");
    [self.view addSubview:self.deleteView];
    self.deleteView.titleLabel.text = @"忘记密码需要重新登录";
    [self.deleteView.deleteBtn setTitle:@"重新登录" forState:0];
    [self.deleteView.deleteBtn setTitleColor:ZZCColor forState:0];
    [self.deleteView.deleteBtn addTarget:self action:@selector(confirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.deleteView.cancelBtn addTarget:self action:@selector(cancelBtnClick) forControlEvents:UIControlEventTouchUpInside];
}
- (void)confirmBtnClick {
    ZZCLog(@"确认-");
    [self.deleteView removeFromSuperview];
}
- (void)cancelBtnClick {
    ZZCLog(@"取消-");
    [self.deleteView removeFromSuperview];
}

- (ZZCDeleteView *)deleteView {
    if (_deleteView == nil) {
        _deleteView = [ZZCDeleteView deleteView];
        _deleteView.frame = CGRectMake(0, 0, ZZCScreenW, ZZCScreenH);
        _deleteView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
    }
    return _deleteView;
}

@end
